import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { Language } from "../../../../../extend/language/Language";
import { GTextFormat } from "../../../../common/GTextFormat";
import { GameProxy } from "../../../mvc/GameProxy";
import { SPlayerCopy } from "../../../../../Message/Public/SPlayerCopy";
import { CopyConfig } from "../../../resource/CopyConfig";
import { HighlightManager } from "../../../manager/HighlightManager";
import { GLabel } from "../../../../../com/mui/controls/GLabel";
import { GButton } from "../../../../../com/mui/controls/GButton";
type int = number;
//class DailyCopyGradeReward
    
    export  class DailyCopyGradeReward /* flash.display.Sprite */
    {
        constructor(arg1: int, arg2: int)
        {
            
            this._width = arg1;
            this._height = arg2;
            this.initUI();
            return;
        }

        protected initUI(): void
        {
            ObjCreate.createBg(0, 0, this._width, this._height, this);
            ObjCreate.createBg(0, 1, 139, 24, this, ImagesConst.TileBg);
            ObjCreate.createLabel(Language.getString(90119), 8, 4, 200, 20, flash.text.TextFormatAlign.LEFT, this, true, 16776960);
            this._bestToday = ObjCreate.createLabel(Language.getString(90120), 8, 27, 130, 20, flash.text.TextFormatAlign.LEFT, this, false);
            this._bestHistory = ObjCreate.createLabel(Language.getString(90121), 8, 44, 130, 20, flash.text.TextFormatAlign.LEFT, this, false);
            this._topGrade = ObjCreate.createLabel(Language.getString(90122), 8, 61, 130, 20, flash.text.TextFormatAlign.LEFT, this, false);
            this._topGrade.htmlText = Language.getString(90123);
            this._rewardBtn = ObjCreate.createGButton(Language.getString(90124), 140, 25, 49, 22, this);
            this._rewardBtn.visible = false;
            this._rewardBtn.addEventListener(flash.events.MouseEvent.CLICK, this.onButtonClick);
            var loc1=ObjCreate.createTextField(Language.getString(90125), 8, 79, 195, 40, this, new GTextFormat(null, 12, 64523));
            loc1.filters = [];
            loc1.wordWrap = true;
            return;
        }

        /* internal  */onButtonClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=arg1.target;
            switch (loc1) 
            {
                case this._rewardBtn:
                {
                    if (this._info) 
                    {
                        GameProxy.copy.getCopyMarkBreakReward(this._info.copyCode);
                    }
                    break;
                }
            }
            return;
        }

        public updateGradeData(arg1: SPlayerCopy): void
        {
            this._info = arg1;
            var loc1=CopyConfig.instance.getCopyGradeInfo(arg1.todayBestCredit);
            if (loc1 && arg1.todayBestCredit > 0) 
            {
                this._bestToday.htmlText = Language.getStringByParam(90126, loc1.levelStringWithColor.toString());
            }
            else 
            {
                this._bestToday.htmlText = Language.getString(90127);
            }
            var loc2=CopyConfig.instance.getCopyGradeInfo(arg1.historyBestCredit);
            if (loc2 && arg1.historyBestCredit > 0) 
            {
                this._bestHistory.htmlText = Language.getStringByParam(90128, loc2.levelStringWithColor.toString());
            }
            else 
            {
                this._bestHistory.htmlText = Language.getString(90129);
            }
            if (arg1.todayBestCredit > 0 && loc1 && loc1.level > arg1.getRewardLevel) 
            {
                this._rewardBtn.visible = true;
                HighlightManager.instance.glowEffectButton(this._rewardBtn, true);
            }
            else 
            {
                this._rewardBtn.visible = false;
                HighlightManager.instance.glowEffectButton(this._rewardBtn, false);
            }
            return;
        }

        /* internal */ /* var */_width: int;

        /* internal */ /* var */_height: int;

        /* internal */ /* var */_info: SPlayerCopy;

        /* internal */ /* var */_bestToday: GLabel;

        /* internal */ /* var */_bestHistory: GLabel;

        /* internal */ /* var */_topGrade: GLabel;

        /* internal */ /* var */_rewardBtn: GButton;
    }
